<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="../assets/js/vue.js"></script>
    <link rel="stylesheet" href="../assets/css/index.css"/>
</head>
<body>
<h1>component-1</h1>
<hr>
<div id="app">
    <hello></hello>
    <world></world>
</div>
<hello></hello><!--hello在外面不管用,必须在作用域里-->
<div id="app1">
    <hello></hello>
</div>

<script>
    //比如页面头尾用全局化注册
    Vue.component('hello', {
        template: '<div>全局化注册的 -&gt; &lt;hello&gt;</div>'
    })

    worldworld = {
        template: '<div>局部注册的 -&gt; &lt;world&gt;</div>'
    }

    var vm = new Vue({
        el: '#app',
        data: {
            message: 'hello Vue'
        },
        components: {//这里有s,全局化的没有s
            "world": worldworld
        }
    })
    var vm1 = new Vue({
        el: '#app1',
        data: {
            message: 'hello Vue'
        }
    })
</script>
</body>
</html>